let arr1 = [1, 2, 1, 2, 3, 5, 4, 5, 3, 4, 4, 4, 4]
let arr2 = []

// 方法一
for (let i = 0; i < arr1.length; ++i) {
  if (arr1.indexOf(arr1[i]) === i)
    arr2.push(arr1[i])
}
console.log(arr2)

// 方法二
arr2.splice(0, arr2.length)
arr2 = [...new Set(arr1)]
console.log(arr2)
